package com.xmg.model.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

/**
 * @author xmg
 * @Description 消息基类
 * @email 463364973@qq.com
 * <p>
 * Date:2019/4/5 16:50
 */
@Data
public class BaseMessage implements Serializable {

    /** 开发者微信号 */
    @XStreamAlias("ToUserName")
    private String toUserName;
    /** 发送方帐号（一个OpenID） */
    @XStreamAlias("FromUserName")
    private String fromUserName;
    /** 消息创建时间 （整型） */
    @XStreamAlias("CreateTime")
    private String createTime;
    /** 消息类型 */
    @XStreamAlias("MsgType")
    private String msgType;

    public BaseMessage(Map<String, String> requestMap) {
        this.toUserName = requestMap.get("FromUserName");
        this.fromUserName = requestMap.get("ToUserName");
        this.createTime = System.currentTimeMillis()/1000+"";
    }
}
